<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * 设备存取表
 * Class GearRecord
 * @package app\index\model
 */
class GearRecord extends Model
{
    use SoftDelete;

    public $autoWriteTimestamp = 'int';
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';
    protected $append = [
        'action_text'
    ];

    public function getActionTextAttr($value,$data)
    {
        $arrAction = ['', '取用', '归还'];
        if (empty($data['action']) || empty($arrAction[$data['action']])) return '';
        return $arrAction[$data['action']];
    }

}